package com.example.bootdemo2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.bootdemo2.entity.User;
import com.example.bootdemo2.dao.UserMapper;
import com.example.bootdemo2.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lml
 * @since 2022-12-25
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Override
    public IPage listBy(User user, Integer currentPage,Integer count) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.like("username",user.getUsername());
        queryWrapper.like("phone",user.getPhone());
        Page page=new Page(currentPage,count);
        IPage page1 = this.page(page,queryWrapper);
        return page1;
    }
}
